Optimal. Leaf size=230 \[ \frac{\left (a^2 \left (-\left (3 c^2 d-d^3\right )\right )+2 a b c \left (c^2-3 d^2\right )+b^2 d \left (3 c^2-d^2\right )\right ) \log (\cos (e+f x))}{f \left (a^2+b^2\right )^2}-\frac{x \left (a^2 \left (-\left (c^3-3 c d^2\right )\right )-2 a b d \left (3 c^2-d^2\right )+b^2 c \left (c^2-3 d^2\right )\right )}{\left (a^2+b^2\right )^2}-\frac{(b c-a d)^2 (c+d \tan (e+f x))}{b f \left (a^2+b^2\right ) (a+b \tan (e+f x))}+\frac{\left (a^2 d+2 a b c+3 b^2 d\right ) (b c-a d)^2 \log (a+b \tan (e+f x))}{b^2 f \left (a^2+b^2\right )^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.341654, antiderivative size = 230, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {3565, 3626, 3617, 31, 3475} \[ \frac{\left (a^2 \left (-\left (3 c^2 d-d^3\right )\right )+2 a b c \left (c^2-3 d^2\right )+b^2 d \left (3 c^2-d^2\right )\right ) \log (\cos (e+f x))}{f \left (a^2+b^2\right )^2}-\frac{x \left (a^2 \left (-\left (c^3-3 c d^2\right )\right )-2 a b d \left (3 c^2-d^2\right )+b^2 c \left (c^2-3 d^2\right )\right )}{\left (a^2+b^2\right )^2}-\frac{(b c-a d)^2 (c+d \tan (e+f x))}{b f \left (a^2+b^2\right ) (a+b \tan (e+f x))}+\frac{\left (a^2 d+2 a b c+3 b^2 d\right ) (b c-a d)^2 \log (a+b \tan (e+f x))}{b^2 f \left (a^2+b^2\right )^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3565
Rule 3626
Rule 3617
Rule 31
Rule 3475
Rubi steps
\begin{align*} \int \frac{(c+d \tan (e+f x))^3}{(a+b \tan (e+f x))^2} \, dx &=-\frac{(b c-a d)^2 (c+d \tan (e+f x))}{b \left (a^2+b^2\right ) f (a+b \tan (e+f x))}+\frac{\int \frac{3 b^2 c^2 d+a^2 d^3+a b c \left (c^2-3 d^2\right )+b \left (a d \left (3 c^2-d^2\right )-b \left (c^3-3 c d^2\right )\right ) \tan (e+f x)+\left (a^2+b^2\right ) d^3 \tan ^2(e+f x)}{a+b \tan (e+f x)} \, dx}{b \left (a^2+b^2\right )}\\ &=-\frac{\left (b^2 c \left (c^2-3 d^2\right )-2 a b d \left (3 c^2-d^2\right )-a^2 \left (c^3-3 c d^2\right )\right ) x}{\left (a^2+b^2\right )^2}-\frac{(b c-a d)^2 (c+d \tan (e+f x))}{b \left (a^2+b^2\right ) f (a+b \tan (e+f x))}+\frac{\left ((b c-a d)^2 \left (2 a b c+a^2 d+3 b^2 d\right )\right ) \int \frac{1+\tan ^2(e+f x)}{a+b \tan (e+f x)} \, dx}{b \left (a^2+b^2\right )^2}-\frac{\left (2 a b c \left (c^2-3 d^2\right )+b^2 d \left (3 c^2-d^2\right )-a^2 \left (3 c^2 d-d^3\right )\right ) \int \tan (e+f x) \, dx}{\left (a^2+b^2\right )^2}\\ &=-\frac{\left (b^2 c \left (c^2-3 d^2\right )-2 a b d \left (3 c^2-d^2\right )-a^2 \left (c^3-3 c d^2\right )\right ) x}{\left (a^2+b^2\right )^2}+\frac{\left (2 a b c \left (c^2-3 d^2\right )+b^2 d \left (3 c^2-d^2\right )-a^2 \left (3 c^2 d-d^3\right )\right ) \log (\cos (e+f x))}{\left (a^2+b^2\right )^2 f}-\frac{(b c-a d)^2 (c+d \tan (e+f x))}{b \left (a^2+b^2\right ) f (a+b \tan (e+f x))}+\frac{\left ((b c-a d)^2 \left (2 a b c+a^2 d+3 b^2 d\right )\right ) \operatorname{Subst}\left (\int \frac{1}{a+x} \, dx,x,b \tan (e+f x)\right )}{b^2 \left (a^2+b^2\right )^2 f}\\ &=-\frac{\left (b^2 c \left (c^2-3 d^2\right )-2 a b d \left (3 c^2-d^2\right )-a^2 \left (c^3-3 c d^2\right )\right ) x}{\left (a^2+b^2\right )^2}+\frac{\left (2 a b c \left (c^2-3 d^2\right )+b^2 d \left (3 c^2-d^2\right )-a^2 \left (3 c^2 d-d^3\right )\right ) \log (\cos (e+f x))}{\left (a^2+b^2\right )^2 f}+\frac{(b c-a d)^2 \left (2 a b c+a^2 d+3 b^2 d\right ) \log (a+b \tan (e+f x))}{b^2 \left (a^2+b^2\right )^2 f}-\frac{(b c-a d)^2 (c+d \tan (e+f x))}{b \left (a^2+b^2\right ) f (a+b \tan (e+f x))}\\ \end{align*}
Mathematica [C] time = 4.63305, size = 535, normalized size = 2.33 \[ \frac{\cos (e+f x) (c+d \tan (e+f x))^3 (a \cos (e+f x)+b \sin (e+f x)) \left (a^2 \cos (e+f x) \left (2 (a+i b)^2 (e+f x) \left (i a^2 d^3+2 a b d^3+b^2 c \left (c^2-3 i c d-3 d^2\right )\right )+(b c-a d)^2 \left (a^2 d+2 a b c+3 b^2 d\right ) \log \left ((a \cos (e+f x)+b \sin (e+f x))^2\right )-2 d^3 \left (a^2+b^2\right )^2 \log (\cos (e+f x))\right )+b \sin (e+f x) \left (2 (a+i b) \left (a^2 b^2 \left (-3 i c^2 d (e+f x-i)+c^3 (e+f x)-3 c d^2 (e+f x+i)+2 i d^3 (e+f x)\right )+a^3 b d^2 (3 c+d (e+f x+i))+i a^4 d^3 (e+f x+i)+a b^3 c \left (c^2 (i e+i f x+1)+3 c d (e+f x+i)-3 i d^2 (e+f x)\right )-i b^4 c^3\right )+a (b c-a d)^2 \left (a^2 d+2 a b c+3 b^2 d\right ) \log \left ((a \cos (e+f x)+b \sin (e+f x))^2\right )-2 a d^3 \left (a^2+b^2\right )^2 \log (\cos (e+f x))\right )-2 i a (b c-a d)^2 \left (a^2 d+2 a b c+3 b^2 d\right ) \tan ^{-1}(\tan (e+f x)) (a \cos (e+f x)+b \sin (e+f x))\right )}{2 a b^2 f (a-i b)^2 (a+i b)^2 (a+b \tan (e+f x))^2 (c \cos (e+f x)+d \sin (e+f x))^3} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.038, size = 671, normalized size = 2.9 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.57135, size = 416, normalized size = 1.81 \begin{align*} \frac{\frac{2 \,{\left (6 \, a b c^{2} d - 2 \, a b d^{3} +{\left (a^{2} - b^{2}\right )} c^{3} - 3 \,{\left (a^{2} - b^{2}\right )} c d^{2}\right )}{\left (f x + e\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac{2 \,{\left (2 \, a b^{3} c^{3} - 6 \, a b^{3} c d^{2} - 3 \,{\left (a^{2} b^{2} - b^{4}\right )} c^{2} d +{\left (a^{4} + 3 \, a^{2} b^{2}\right )} d^{3}\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}} - \frac{{\left (2 \, a b c^{3} - 6 \, a b c d^{2} - 3 \,{\left (a^{2} - b^{2}\right )} c^{2} d +{\left (a^{2} - b^{2}\right )} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac{2 \,{\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )}}{a^{3} b^{2} + a b^{4} +{\left (a^{2} b^{3} + b^{5}\right )} \tan \left (f x + e\right )}}{2 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.10335, size = 1037, normalized size = 4.51 \begin{align*} -\frac{2 \, b^{5} c^{3} - 6 \, a b^{4} c^{2} d + 6 \, a^{2} b^{3} c d^{2} - 2 \, a^{3} b^{2} d^{3} - 2 \,{\left (6 \, a^{2} b^{3} c^{2} d - 2 \, a^{2} b^{3} d^{3} +{\left (a^{3} b^{2} - a b^{4}\right )} c^{3} - 3 \,{\left (a^{3} b^{2} - a b^{4}\right )} c d^{2}\right )} f x -{\left (2 \, a^{2} b^{3} c^{3} - 6 \, a^{2} b^{3} c d^{2} - 3 \,{\left (a^{3} b^{2} - a b^{4}\right )} c^{2} d +{\left (a^{5} + 3 \, a^{3} b^{2}\right )} d^{3} +{\left (2 \, a b^{4} c^{3} - 6 \, a b^{4} c d^{2} - 3 \,{\left (a^{2} b^{3} - b^{5}\right )} c^{2} d +{\left (a^{4} b + 3 \, a^{2} b^{3}\right )} d^{3}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac{b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) +{\left ({\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} d^{3} \tan \left (f x + e\right ) +{\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} d^{3}\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \,{\left (a b^{4} c^{3} - 3 \, a^{2} b^{3} c^{2} d + 3 \, a^{3} b^{2} c d^{2} - a^{4} b d^{3} +{\left (6 \, a b^{4} c^{2} d - 2 \, a b^{4} d^{3} +{\left (a^{2} b^{3} - b^{5}\right )} c^{3} - 3 \,{\left (a^{2} b^{3} - b^{5}\right )} c d^{2}\right )} f x\right )} \tan \left (f x + e\right )}{2 \,{\left ({\left (a^{4} b^{3} + 2 \, a^{2} b^{5} + b^{7}\right )} f \tan \left (f x + e\right ) +{\left (a^{5} b^{2} + 2 \, a^{3} b^{4} + a b^{6}\right )} f\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: AttributeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.92834, size = 605, normalized size = 2.63 \begin{align*} \frac{\frac{2 \,{\left (a^{2} c^{3} - b^{2} c^{3} + 6 \, a b c^{2} d - 3 \, a^{2} c d^{2} + 3 \, b^{2} c d^{2} - 2 \, a b d^{3}\right )}{\left (f x + e\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac{{\left (2 \, a b c^{3} - 3 \, a^{2} c^{2} d + 3 \, b^{2} c^{2} d - 6 \, a b c d^{2} + a^{2} d^{3} - b^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac{2 \,{\left (2 \, a b^{3} c^{3} - 3 \, a^{2} b^{2} c^{2} d + 3 \, b^{4} c^{2} d - 6 \, a b^{3} c d^{2} + a^{4} d^{3} + 3 \, a^{2} b^{2} d^{3}\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}} - \frac{2 \,{\left (2 \, a b^{3} c^{3} \tan \left (f x + e\right ) - 3 \, a^{2} b^{2} c^{2} d \tan \left (f x + e\right ) + 3 \, b^{4} c^{2} d \tan \left (f x + e\right ) - 6 \, a b^{3} c d^{2} \tan \left (f x + e\right ) + a^{4} d^{3} \tan \left (f x + e\right ) + 3 \, a^{2} b^{2} d^{3} \tan \left (f x + e\right ) + 3 \, a^{2} b^{2} c^{3} + b^{4} c^{3} - 6 \, a^{3} b c^{2} d + 3 \, a^{4} c d^{2} - 3 \, a^{2} b^{2} c d^{2} + 2 \, a^{3} b d^{3}\right )}}{{\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )}{\left (b \tan \left (f x + e\right ) + a\right )}}}{2 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]